package com.xywl.escort.view.market.skus;

import com.xywl.escort.bean.BaseSkuModel;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * sku数据存储Model类
 */
public class ProductModel {

    //存储所有录入的库存情况
    public Map<String, BaseSkuModel> productStocks = new HashMap<>();

    //记录规格的种类
    public List<AttributesEntity> attributes = new ArrayList<>();

    public static class AttributesEntity {

        public int id;
        public String name;
        public List<AttributeMembersEntity> attributeMembers = new ArrayList<>();

        public static class AttributeMembersEntity {

            public int attributeGroupId;
            public int attributeMemberId;
            public String name;
            public int status;

            public AttributeMembersEntity(int attributeGroupId, int attributeMemberId, String name) {
                this.attributeGroupId = attributeGroupId;
                this.attributeMemberId = attributeMemberId;
                this.name = name;
            }

            @Override
            public boolean equals(Object obj) {
                if (!(obj instanceof AttributeMembersEntity))
                    return false;
                AttributeMembersEntity entity = (AttributeMembersEntity) obj;
                return entity.name.equals(name) && entity.attributeGroupId == attributeGroupId && entity.attributeMemberId == attributeMemberId;
            }
        }
    }
}